struct VS_IN
{
	float3 position : POSITION;
	float3 normal	: NORMAL;
	float3 tangent : TANGENT;
	float2 tex		: TEX_COORDS;
};


struct VS_OUT
{
	float4 position : SV_POSITION;
	float2 tex		: TEXCOORDS;
};


SamplerState s_volume
{
    Filter = MIN_MAG_MIP_POINT;
    AddressU = Clamp;
    AddressV = Clamp;
    AddressW = Clamp;
};


Texture2D tex;
Texture3D tex_3d;

float slice;
uint depth;

SamplerState tex_sampler
{
	Filter = MIN_MAG_MIP_LINEAR;
};

VS_OUT VS(VS_IN vin)
{

	VS_OUT vout;

	vout.position = float4(vin.position, 1.0f);
	vout.tex      = float2(vin.position.xy);
	
	return vout;
}

float4 PS(VS_OUT pin) : SV_TARGET
{
	float2 v = pin.tex * float2(0.5f, -0.5f) + float2(0.5f, 0.5f);
	float d = tex.Sample(tex_sampler, v).r;
	return float4(d, d, d, 1.0f);
}


RasterizerState rs_state
{
	CullMode = Front;
};

technique10 Shadow_Mapping
{
	pass P0
	{
		SetVertexShader ( CompileShader (vs_4_0, VS() ) );
		SetGeometryShader( NULL);
		SetPixelShader  ( CompileShader ( ps_4_0, PS() ) );
		
		SetRasterizerState(rs_state);
	}

	
}
